#include "processbar.h"
#define CAPACITY 102
#define STYLE '#' //进度条的样式
#define HEAD '>'
void processbar()
{
    char buffer[CAPACITY];
    char* animation="\\|/-";
    memset(buffer,'\0',CAPACITY);
    int cnt=0;
    while (cnt<=100)
    {
        printf("[%-101s] %3d%%\r",buffer,cnt);
        fflush(stdout);
        buffer[cnt++]=STYLE;
        buffer[cnt]=HEAD;
        usleep(8000);
    }
    cnt--;//cnt变成100
    buffer[cnt]=STYLE;
    buffer[cnt+1]='\0';
    printf("[%-101s] %3d%%\r",buffer,cnt);
    fflush(stdout);
    printf("\n");
}


